Assert and Retract in Shen Prolog


 

 

'assert' and 'retract' were brought into Shen Prolog with version 34. In order to use these features.'asserta' and 'assertz' (see any introduction to Prolog on the use of these predicates) is used to assert clauses.

In and after S34.5 Prolog predicates need not be declared dynamic. Note though that dynamically defined Prolog procedures can only be defined using assert(a/z) and retract. An attempt to define them using defprolog will disable the ability to use assert(a/z) and retract. assert(a/z) and retract are regular Shen functions, not Prolog calls.

(0-) (asserta [[male bill] <--;])
male

(1-) (prolog? (male bill))
true

(2-) (retract [[male bill] <--;])
[]

(3-) (prolog? (male bill))
false

Built by Shen Technology (c) Mark Tarver, September 2021